package com.icss.ah.payBillFlow.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.icss.ah.base.bean.EasyuiDataGridJson;

@Service
public class PayBillFlowService {
	
	private final Logger errlog = Logger.getLogger("E");
	private final Logger infolog = Logger.getLogger("I");
	
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;
	private EasyuiDataGridJson dataGridJson = new EasyuiDataGridJson();
	
	public EasyuiDataGridJson queryPayBillFlowList(Map<String, String> map){
		try {
			List<Map<String, Object>> rows = sqlSessionTemplate.selectList("PayBillFlowBean.queryPayBillFlowList",map);
			Long total = sqlSessionTemplate.selectOne("PayBillFlowBean.queryPayBillFlowListCount",map);
			dataGridJson.setRows(rows);
			dataGridJson.setTotal(total);
			infolog.info("PayBillFlowService|queryPayBillFlowList|para:"+map+"|total:"+total+"|list:"+rows);
		} catch (Exception e) {
			e.printStackTrace();
			errlog.error("PayBillFlowService|queryPayBillFlowList|异常：",e);
		}
		return dataGridJson;
	}
	
	public List<Map<String, Object>> queryExportPayBillFlow(Map<String, String> map){
		List<Map<String, Object>> rows = new ArrayList<Map<String,Object>>();
		try {
			rows = sqlSessionTemplate.selectList("PayBillFlowBean.queryExportPayBillFlow",map);
			infolog.info("PayBillFlowService|queryExportPayBillFlow|para:"+map+"|list:"+rows);
		} catch (Exception e) {
			e.printStackTrace();
			errlog.error("PayBillFlowService|queryExportPayBillFlow|异常：",e);
		}
		return rows;
	}
	
	public List<Map<String, Object>> queryOrderTypeList(){
		List<Map<String, Object>> rows = new ArrayList<Map<String,Object>>();
		try {
			rows = sqlSessionTemplate.selectList("PayBillFlowBean.queryOrderTypeList");
			infolog.info("PayBillFlowService|queryOrderTypeList|list:"+rows);
		} catch (Exception e) {
			e.printStackTrace();
			errlog.error("PayBillFlowService|queryOrderTypeList|异常：",e);
		}
		return rows;
	}

}
